3.511 \(\int \sqrt{\cot (c+d x)} (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=105 \[ -\frac{2 a^2 (3 A-5 i B)}{3 d \sqrt{\cot (c+d x)}}+\frac{4 \sqrt [4]{-1} a^2 (B+i A) \tanh ^{-1}\left ((-1)^{3/4} \sqrt{\cot (c+d x)}\right )}{d}+\frac{2 i B \left (a^2 \cot (c+d x)+i a^2\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)} \]

[Out]

(4*(-1)^(1/4)*a^2*(I*A + B)*ArcTanh[(-1)^(3/4)*Sqrt[Cot[c + d*x]]])/d - (2*a^2*(3*A - (5*I)*B))/(3*d*Sqrt[Cot[
c + d*x]]) + (((2*I)/3)*B*(I*a^2 + a^2*Cot[c + d*x]))/(d*Cot[c + d*x]^(3/2))

________________________________________________________________________________________

Rubi [A]  time = 0.325542, antiderivative size = 105, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 36, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.139, Rules used = {3581, 3593, 3591, 3533, 208} \[ -\frac{2 a^2 (3 A-5 i B)}{3 d \sqrt{\cot (c+d x)}}+\frac{4 \sqrt [4]{-1} a^2 (B+i A) \tanh ^{-1}\left ((-1)^{3/4} \sqrt{\cot (c+d x)}\right )}{d}+\frac{2 i B \left (a^2 \cot (c+d x)+i a^2\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)} \]

Antiderivative was successfully verified.

[In]

Int[Sqrt[Cot[c + d*x]]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(4*(-1)^(1/4)*a^2*(I*A + B)*ArcTanh[(-1)^(3/4)*Sqrt[Cot[c + d*x]]])/d - (2*a^2*(3*A - (5*I)*B))/(3*d*Sqrt[Cot[
c + d*x]]) + (((2*I)/3)*B*(I*a^2 + a^2*Cot[c + d*x]))/(d*Cot[c + d*x]^(3/2))

Rule 3581

Int[(cot[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.)
 + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[g^(m + n), Int[(g*Cot[e + f*x])^(p - m - n)*(b + a*Cot[e + f*x])^m*(d
 + c*Cot[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] &&  !IntegerQ[p] && IntegerQ[m] && IntegerQ
[n]

Rule 3593

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[(a^2*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^
(n + 1))/(d*f*(b*c + a*d)*(n + 1)), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c +
 d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m -
 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && EqQ
[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rule 3591

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((b*c - a*d)*(A*b - a*B)*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2
 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*
c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rule 3533

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/Sqrt[(b_.)*tan[(e_.) + (f_.)*(x_)]], x_Symbol] :> Dist[(2*c^2)/f, S
ubst[Int[1/(b*c - d*x^2), x], x, Sqrt[b*Tan[e + f*x]]], x] /; FreeQ[{b, c, d, e, f}, x] && EqQ[c^2 + d^2, 0]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rubi steps

\begin{align*} \int \sqrt{\cot (c+d x)} (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\int \frac{(i a+a \cot (c+d x))^2 (B+A \cot (c+d x))}{\cot ^{\frac{5}{2}}(c+d x)} \, dx\\ &=\frac{2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)}+\frac{2}{3} \int \frac{(i a+a \cot (c+d x)) \left (\frac{1}{2} a (3 i A+5 B)+\frac{1}{2} a (3 A-i B) \cot (c+d x)\right )}{\cot ^{\frac{3}{2}}(c+d x)} \, dx\\ &=-\frac{2 a^2 (3 A-5 i B)}{3 d \sqrt{\cot (c+d x)}}+\frac{2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)}+\frac{2}{3} \int \frac{3 a^2 (i A+B)+3 a^2 (A-i B) \cot (c+d x)}{\sqrt{\cot (c+d x)}} \, dx\\ &=-\frac{2 a^2 (3 A-5 i B)}{3 d \sqrt{\cot (c+d x)}}+\frac{2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)}+\frac{\left (12 a^4 (i A+B)^2\right ) \operatorname{Subst}\left (\int \frac{1}{-3 a^2 (i A+B)+3 a^2 (A-i B) x^2} \, dx,x,\sqrt{\cot (c+d x)}\right )}{d}\\ &=\frac{4 \sqrt [4]{-1} a^2 (i A+B) \tanh ^{-1}\left ((-1)^{3/4} \sqrt{\cot (c+d x)}\right )}{d}-\frac{2 a^2 (3 A-5 i B)}{3 d \sqrt{\cot (c+d x)}}+\frac{2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac{3}{2}}(c+d x)}\\ \end{align*}

Mathematica [B]  time = 3.53968, size = 254, normalized size = 2.42 \[ \frac{a^2 e^{-i (c-d x)} \sqrt{\cot (c+d x)} \left (A \left (1+e^{2 i (c+d x)}\right )-i B \left (-1+e^{2 i (c+d x)}\right )\right ) \left (\left (-1+e^{2 i (c+d x)}\right ) \left (3 i A \left (1+e^{2 i (c+d x)}\right )+B \left (5+7 e^{2 i (c+d x)}\right )\right )-6 i (A-i B) \sqrt{\frac{-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}} \left (1+e^{2 i (c+d x)}\right )^2 \tanh ^{-1}\left (\sqrt{\frac{-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}\right )\right )}{3 d \left (e^{2 i c+3 i d x}+e^{i d x}\right )^2 (A \cos (c+d x)+B \sin (c+d x))} \]

Antiderivative was successfully verified.

[In]

Integrate[Sqrt[Cot[c + d*x]]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(a^2*((-I)*B*(-1 + E^((2*I)*(c + d*x))) + A*(1 + E^((2*I)*(c + d*x))))*((-1 + E^((2*I)*(c + d*x)))*((3*I)*A*(1
 + E^((2*I)*(c + d*x))) + B*(5 + 7*E^((2*I)*(c + d*x)))) - (6*I)*(A - I*B)*Sqrt[(-1 + E^((2*I)*(c + d*x)))/(1
+ E^((2*I)*(c + d*x)))]*(1 + E^((2*I)*(c + d*x)))^2*ArcTanh[Sqrt[(-1 + E^((2*I)*(c + d*x)))/(1 + E^((2*I)*(c +
 d*x)))]])*Sqrt[Cot[c + d*x]])/(3*d*E^(I*(c - d*x))*(E^(I*d*x) + E^((2*I)*c + (3*I)*d*x))^2*(A*Cos[c + d*x] +
B*Sin[c + d*x]))

________________________________________________________________________________________

Maple [C]  time = 0.458, size = 888, normalized size = 8.5 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^(1/2)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)

[Out]

1/3*a^2/d*2^(1/2)*(cos(d*x+c)-1)*(6*I*A*((cos(d*x+c)-1)/sin(d*x+c))^(1/2)*((cos(d*x+c)-1+sin(d*x+c))/sin(d*x+c
))^(1/2)*(-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2)*cos(d*x+c)*sin(d*x+c)*EllipticPi((-(cos(d*x+c)-1-sin(d*
x+c))/sin(d*x+c))^(1/2),1/2+1/2*I,1/2*2^(1/2))+6*I*B*((cos(d*x+c)-1)/sin(d*x+c))^(1/2)*((cos(d*x+c)-1+sin(d*x+
c))/sin(d*x+c))^(1/2)*(-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2)*cos(d*x+c)*sin(d*x+c)*EllipticPi((-(cos(d*
x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2),1/2+1/2*I,1/2*2^(1/2))-6*I*B*((cos(d*x+c)-1)/sin(d*x+c))^(1/2)*((cos(d*x+
c)-1+sin(d*x+c))/sin(d*x+c))^(1/2)*(-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2)*cos(d*x+c)*sin(d*x+c)*Ellipti
cF((-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2),1/2*2^(1/2))-6*A*cos(d*x+c)*sin(d*x+c)*(-(cos(d*x+c)-1-sin(d*
x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1+sin(d*x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1)/sin(d*x+c))^(1/2)*Ellipti
cPi((-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2),1/2+1/2*I,1/2*2^(1/2))+6*A*cos(d*x+c)*sin(d*x+c)*(-(cos(d*x+
c)-1-sin(d*x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1+sin(d*x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1)/sin(d*x+c))^(1
/2)*EllipticF((-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2),1/2*2^(1/2))+6*B*cos(d*x+c)*sin(d*x+c)*(-(cos(d*x+
c)-1-sin(d*x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1+sin(d*x+c))/sin(d*x+c))^(1/2)*((cos(d*x+c)-1)/sin(d*x+c))^(1
/2)*EllipticPi((-(cos(d*x+c)-1-sin(d*x+c))/sin(d*x+c))^(1/2),1/2+1/2*I,1/2*2^(1/2))+6*I*B*2^(1/2)*cos(d*x+c)^2
-3*A*2^(1/2)*cos(d*x+c)^2-6*I*B*2^(1/2)*cos(d*x+c)-B*2^(1/2)*cos(d*x+c)*sin(d*x+c)+3*A*cos(d*x+c)*2^(1/2)+B*2^
(1/2)*sin(d*x+c))*(cos(d*x+c)+1)^2*(cos(d*x+c)/sin(d*x+c))^(1/2)/cos(d*x+c)^2/sin(d*x+c)^3

________________________________________________________________________________________

Maxima [B]  time = 1.56511, size = 244, normalized size = 2.32 \begin{align*} \frac{3 \,{\left (2 \, \sqrt{2}{\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (\frac{1}{2} \, \sqrt{2}{\left (\sqrt{2} + \frac{2}{\sqrt{\tan \left (d x + c\right )}}\right )}\right ) + 2 \, \sqrt{2}{\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (-\frac{1}{2} \, \sqrt{2}{\left (\sqrt{2} - \frac{2}{\sqrt{\tan \left (d x + c\right )}}\right )}\right ) - \sqrt{2}{\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (\frac{\sqrt{2}}{\sqrt{\tan \left (d x + c\right )}} + \frac{1}{\tan \left (d x + c\right )} + 1\right ) + \sqrt{2}{\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (-\frac{\sqrt{2}}{\sqrt{\tan \left (d x + c\right )}} + \frac{1}{\tan \left (d x + c\right )} + 1\right )\right )} a^{2} - 4 \,{\left (B a^{2} + \frac{{\left (3 \, A - 6 i \, B\right )} a^{2}}{\tan \left (d x + c\right )}\right )} \tan \left (d x + c\right )^{\frac{3}{2}}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^(1/2)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(3*(2*sqrt(2)*(-(I + 1)*A + (I - 1)*B)*arctan(1/2*sqrt(2)*(sqrt(2) + 2/sqrt(tan(d*x + c)))) + 2*sqrt(2)*(-
(I + 1)*A + (I - 1)*B)*arctan(-1/2*sqrt(2)*(sqrt(2) - 2/sqrt(tan(d*x + c)))) - sqrt(2)*((I - 1)*A + (I + 1)*B)
*log(sqrt(2)/sqrt(tan(d*x + c)) + 1/tan(d*x + c) + 1) + sqrt(2)*((I - 1)*A + (I + 1)*B)*log(-sqrt(2)/sqrt(tan(
d*x + c)) + 1/tan(d*x + c) + 1))*a^2 - 4*(B*a^2 + (3*A - 6*I*B)*a^2/tan(d*x + c))*tan(d*x + c)^(3/2))/d

________________________________________________________________________________________

Fricas [B]  time = 1.50129, size = 1172, normalized size = 11.16 \begin{align*} \frac{3 \, \sqrt{\frac{{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}}{\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac{{\left (4 \,{\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + \sqrt{\frac{{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}}{\left (d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )} \sqrt{\frac{i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (2 i \, A + 2 \, B\right )} a^{2}}\right ) - 3 \, \sqrt{\frac{{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}}{\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac{{\left (4 \,{\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - \sqrt{\frac{{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}}{\left (d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )} \sqrt{\frac{i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (2 i \, A + 2 \, B\right )} a^{2}}\right ) +{\left ({\left (24 i \, A + 56 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 16 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (-24 i \, A - 40 \, B\right )} a^{2}\right )} \sqrt{\frac{i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}}{12 \,{\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^(1/2)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(3*sqrt((-16*I*A^2 - 32*A*B + 16*I*B^2)*a^4/d^2)*(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) + d)*lo
g(-(4*(A - I*B)*a^2*e^(2*I*d*x + 2*I*c) + sqrt((-16*I*A^2 - 32*A*B + 16*I*B^2)*a^4/d^2)*(d*e^(2*I*d*x + 2*I*c)
 - d)*sqrt((I*e^(2*I*d*x + 2*I*c) + I)/(e^(2*I*d*x + 2*I*c) - 1)))*e^(-2*I*d*x - 2*I*c)/((2*I*A + 2*B)*a^2)) -
 3*sqrt((-16*I*A^2 - 32*A*B + 16*I*B^2)*a^4/d^2)*(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) + d)*log(-(4
*(A - I*B)*a^2*e^(2*I*d*x + 2*I*c) - sqrt((-16*I*A^2 - 32*A*B + 16*I*B^2)*a^4/d^2)*(d*e^(2*I*d*x + 2*I*c) - d)
*sqrt((I*e^(2*I*d*x + 2*I*c) + I)/(e^(2*I*d*x + 2*I*c) - 1)))*e^(-2*I*d*x - 2*I*c)/((2*I*A + 2*B)*a^2)) + ((24
*I*A + 56*B)*a^2*e^(4*I*d*x + 4*I*c) - 16*B*a^2*e^(2*I*d*x + 2*I*c) + (-24*I*A - 40*B)*a^2)*sqrt((I*e^(2*I*d*x
 + 2*I*c) + I)/(e^(2*I*d*x + 2*I*c) - 1)))/(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) + d)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} a^{2} \left (\int A \sqrt{\cot{\left (c + d x \right )}}\, dx + \int - A \tan ^{2}{\left (c + d x \right )} \sqrt{\cot{\left (c + d x \right )}}\, dx + \int B \tan{\left (c + d x \right )} \sqrt{\cot{\left (c + d x \right )}}\, dx + \int - B \tan ^{3}{\left (c + d x \right )} \sqrt{\cot{\left (c + d x \right )}}\, dx + \int 2 i A \tan{\left (c + d x \right )} \sqrt{\cot{\left (c + d x \right )}}\, dx + \int 2 i B \tan ^{2}{\left (c + d x \right )} \sqrt{\cot{\left (c + d x \right )}}\, dx\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**(1/2)*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)

[Out]

a**2*(Integral(A*sqrt(cot(c + d*x)), x) + Integral(-A*tan(c + d*x)**2*sqrt(cot(c + d*x)), x) + Integral(B*tan(
c + d*x)*sqrt(cot(c + d*x)), x) + Integral(-B*tan(c + d*x)**3*sqrt(cot(c + d*x)), x) + Integral(2*I*A*tan(c +
d*x)*sqrt(cot(c + d*x)), x) + Integral(2*I*B*tan(c + d*x)**2*sqrt(cot(c + d*x)), x))

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \tan \left (d x + c\right ) + A\right )}{\left (i \, a \tan \left (d x + c\right ) + a\right )}^{2} \sqrt{\cot \left (d x + c\right )}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^(1/2)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

integrate((B*tan(d*x + c) + A)*(I*a*tan(d*x + c) + a)^2*sqrt(cot(d*x + c)), x)